﻿@{
    ViewBag.Title = "综合文档管理";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
 @section head{
        <style type="text/css">
            div#navigation{background:white}
            div#wrapper{float:right;width:100%;margin-left:-235px}
            div#content{margin-left:235px}
            div#navigation{float:left;width:230px}
            .datagrid-cell a{color:black;}
            .datagrid-cell a:hover{color:red;}
        </style>
}
@section scripts{
    <script src="~/Areas/qms/ViewModels/qms.FileContent.js"></script>
    <script src="~/Content/js/jquery-plugin/fineuploader-3.7.1/jquery.fineuploader-3.7.1.min.js"></script>
    <script type="text/javascript">
        var vmInstance;
         using("lookup", easyuifix.datagrid_editor_extend); //动态载入这些组件
        using(['datagrid','validatebox','messager']);
        var data = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model));
        vmInstance = new viewModel();
        ko.bindingViewModel(vmInstance); 
        //
//        setTimeout(initUploader,100);
        //
        var formatterPermit = function (value, row) {
            if ( row["FileContent_Fjsl"] > 0 )
            {
                var  html = '<a href="#" onclick=\'fundownload(' + JSON.stringify(row) + ')\' style="margin-left:2px"><span class="icon icon-download ">&nbsp;</span>[下载]</a>';
                return html;
            }
        };
    </script>
}
<div id="container">
    <div id="wrapper">
        <div id="content">
            <div class="z-toolbar">
                <a id="a_refresh" href="#" plain="true" class="easyui-linkbutton" icon="icon-arrow_refresh" title="刷新" data-bind="click:refreshClick">刷新</a>
                <a id="a_add"    href="#" plain="true" class="easyui-linkbutton" icon="icon-add" title="新增" data-bind="click:addClick">新增</a>
                <a id="a_edit"   href="#" plain="true" class="easyui-linkbutton" icon="icon-edit"  title="编辑" data-bind="click:editClick">编辑</a>
                <a id="a_del"    href="#" plain="true" class="easyui-linkbutton" icon="icon-cross" title="删除" data-bind="click:deleteClick">删除</a>
                <a id="a_save" href="#" plain="true" class="easyui-linkbutton" icon="icon-save"   title="保存"  data-bind="click:saveClick" >保存</a>
                <a id="uploader" class="easyui-linkbutton" icon="icon-upload" data-bind="click:upClick" plain="true" title="上传">上传</a>
                <a id="a_save" href="#" plain="true" class="easyui-linkbutton" icon="icon-node_tree" data-bind="click:typeClick" title="文档类别">文档类别</a>
            </div>
           
            <table id="gridlist" data-bind="datagrid:grid">
                 <thead>  
                    <tr>  
                        <th field="FileContent_FileBh"   sortable="true" align="left"    width="100" editor="{type:'validatebox',options:{required:true}}"  >文档编号  </th> 
                        <th field="FileContent_TypeBh" hidden = "true" sortable="true" align="left"    width="100"   >类别编号  </th> 
                        <th field="FileContent_Title"    sortable="true" align="left"    width="150" editor="text"   >文档名称  </th> 
                        <th field="FileContent_Text"    sortable="true" align="left"    width="150" editor="text"   >文档说明  </th> 
                        <th field="FileContent_Bmbh"     editor="{type:'lookup',options:{lookupType:'organize',parentField:'pid'}}" sortable="true" align="left"    width="100"   >单位编号   </th> 
                        <th field="FileContent_Bmmc" sortable="true" align="left"    width="100"   >单位名称</th>   
                        <th field="FileContent_UserCode" sortable="true" align="left"    width="80"  editor="text" >用户</th>   
                        <th field="Permit" align="center"    width="80" formatter="formatterPermit">操作</th> 
                        <th field="CreatePerson"         sortable="true" align="center"    width="100" editor="text">建档人</th>  
                        <th field="CreateDate"           sortable="true" align="center"    width="100" editor="text"   formatter="com.formatDate"  >建档日期</th> 
                    </tr>                            
                </thead>      
            </table> 
        </div>
    </div>
    <div id="navigation">
        <div title="文档类别" style="width: 230px;" class="easyui-panel" data-options="title: '文档类别', iconCls: 'icon-node_tree', height: $(window).height() - 4 ">
            <ul data-bind="easyuiTree:tree"></ul>
        </div>
    </div>
</div>


<script type="text/html" id="type-template">

    <style type="text/css">
        .datagrid-wrap{border-width:0 0 1px 0;}
    </style>

    <table data-bind="treegrid:grid">
        <thead>
            <th field="_id"  hidden="true"></th>  
            <th field="FileType_Bh"        sortable="true" align="left"    width="130" editor="{type:'validatebox',options:{required:true}}">类别编码</th>
            <th field="FileType_Mc"        sortable="true" align="left"    width="150" editor="{type:'validatebox',options:{required:true}}">类别名称</th>
            <th field="FileType_ParentBh"  sortable="true" align="left"    width="100" editor="text"  >上级编码  </th>  
            <th field="FileType_Remark"    sortable="true" align="right"   width="150"  editor="text">备注       </th>  
        </thead>
    </table>
    
    <div style="text-align:center;margin:5px;">
        <a class="easyui-linkbutton" data-options="iconCls:'icon-ok'" data-bind="click:confirmClick" href="javascript:void(0)"  >确定</a>  
        <a class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" data-bind="click:cancelClick" href="javascript:void(0)">取消</a> 
    </div>
</script> 
        
